#include "ParticleDragGenerator.h"

namespace SimPhy
{


ParticleDragGenerator::ParticleDragGenerator(real const k1, real const k2 ): m_k1(k1), m_k2(k2)
{
}

ParticleDragGenerator::~ParticleDragGenerator()
{

}

void ParticleDragGenerator::updateForce(Particle *particle, real timeStep)
{
    Vector3D force;
    force=particle->getVelocity();

    real dragCoeff = force.lenght();
    dragCoeff = m_k1*dragCoeff+m_k2*dragCoeff*dragCoeff;

    force.normalize();
    force=-force*dragCoeff;
    particle->addForce(force);
}



}
